import { Transform } from "class-transformer";
import { IsDateString, IsNotEmpty, IsNumber, IsString } from "class-validator";

export class CreateStudentDto {

  @IsNotEmpty()
  @IsString()
  username: string;

  @IsNotEmpty()
  @IsNumber()
  @Transform((params) => {
    return Number(params.value)
  })
  age: number;

  @IsNotEmpty()
  @IsString()
  address: string;

  @IsNotEmpty()
  @IsNumber()
  @Transform((params) => {
    return Number(params.value)
  })
  big: number;

  @IsNotEmpty()
  @IsString()
  color: string;

  @IsNotEmpty()
  @IsString()
  hobby: string;

  @IsNotEmpty()
  @IsNumber()
  @Transform((params) => {
    return Number(params.value)
  })
  sex: number;

  @IsNotEmpty()
  @IsString()
  school: string;

  @IsNotEmpty()
  @IsDateString()
  time: Date;

  @IsNotEmpty()
  @IsString()
  avatarUrl: string;

}
